% construct diffusion and random force part
function rest = randomforce(t,y,R,sig)

load('orthbase');

load('indexJNKR');

row=size(JNKR,1); colum=size(JNKR,2);
if row >=2
    rest(row)=0;
end
tmp = JNKR(sum(JNKR,2)==1,:);
dt1=1/100; 
dt2=1/10000;
%t2courseindex=floor((t+0.5*dt1)/dt1)+1;
t2fineindex  =floor((t+0.5*dt2)/dt2)+1;
rest(1)=R(t)-1/2*sig(t2fineindex).^2;
for ii=1:colum
    rdforce= tmp(:,ii)==1;
    rest(rdforce)= rest(rdforce)+sig(t2fineindex)*ms{ii}(t);
end

rest=rest';




